/**
 * jQuery EasyUI 1.4.2
 * 
 * Copyright (c) 2009-2015 www.jeasyui.com. All rights reserved.
 *
 * Licensed under the GPL license: http://www.gnu.org/licenses/gpl.txt
 * To use it on other terms please contact us at info@jeasyui.com
 *
 */
(function ($) {
    var _1 = 0;
    function _2(a, o) {
        for (var i = 0, _3 = a.length; i < _3; i++) {
            if (a[i] == o) {
                return i;
            }
        }
        return -1;
    };
    function _4(a, o, id) {
        if (typeof o == "string") {
            for (var i = 0, _5 = a.length; i < _5; i++) {
                if (a[i][o] == id) {
                    a.splice(i, 1);
                    return;
                }
            }
        } else {
            var _6 = _2(a, o);
            if (_6 != -1) {
                a.splice(_6, 1);
            }
        }
    };
    function _7(a, o, r) {
        for (var i = 0, _8 = a.length; i < _8; i++) {
            if (a[i][o] == r[o]) {
                return;
            }
        }
        a.push(r);
    };
    function _9(_a, aa) {
        return $.data(_a, "treegrid") ? aa.slice(1) : aa;
    };
    function _b(_c) {
        var _d = $.data(_c, "datagrid");
        var _e = _d.options;
        var _f = _d.panel;
        var dc = _d.dc;
        var ss = null;
        if (_e.sharedStyleSheet) {
            ss = typeof _e.sharedStyleSheet == "boolean" ? "head" : _e.sharedStyleSheet;
        } else {
            ss = _f.closest("div.datagrid-view");
            if (!ss.length) {
                ss = dc.view;
            }
        }
        var cc = $(ss);
        var _10 = $.data(cc[0], "ss");
        if (!_10) {
            _10 = $.data(cc[0], "ss", { cache: {}, dirty: [] });
        }
        return {
            add: function (_11) {
                var ss = ["<style type=\"text/css\" easyui=\"true\">"];
                for (var i = 0; i < _11.length; i++) {
                    _10.cache[_11[i][0]] = { width: _11[i][1] };
                }
                var _12 = 0;
                for (var s in _10.cache) {
                    var _13 = _10.cache[s];
                    _13.index = _12++;
                    ss.push(s + "{width:" + _13.width + "}");
                }
                ss.push("</style>");
                $(ss.join("\n")).appendTo(cc);
                cc.children("style[easyui]:not(:last)").remove();
            }, getRule: function (_14) {
                var _15 = cc.children("style[easyui]:last")[0];
                var _16 = _15.styleSheet ? _15.styleSheet : (_15.sheet || document.styleSheets[document.styleSheets.length - 1]);
                var _17 = _16.cssRules || _16.rules;
                return _17[_14];
            }, set: function (_18, _19) {
                var _1a = _10.cache[_18];
                if (_1a) {
                    _1a.width = _19;
                    var _1b = this.getRule(_1a.index);
                    if (_1b) {
                        _1b.style["width"] = _19;
                    }
                }
            }, remove: function (_1c) {
                var tmp = [];
                for (var s in _10.cache) {
                    if (s.indexOf(_1c) == -1) {
                        tmp.push([s, _10.cache[s].width]);
                    }
                }
                _10.cache = {};
                this.add(tmp);
            }, dirty: function (_1d) {
                if (_1d) {
                    _10.dirty.push(_1d);
                }
            }, clean: function () {
                for (var i = 0; i < _10.dirty.length; i++) {
                    this.remove(_10.dirty[i]);
                }
                _10.dirty = [];
            }
        };
    };
    function _1e(_1f, _20) {
        var _21 = $.data(_1f, "datagrid");
        var _22 = _21.options;
        var _23 = _21.panel;
        if (_20) {
            $.extend(_22, _20);
        }
        if (_22.fit == true) {
            var p = _23.panel("panel").parent();
            _22.width = p.width();
            _22.height = p.height();
        }
        _23.panel("resize", _22);
    };
    function _24(target) {
        var state = $.data(target, "datagrid");
        var opts = state.options;
        var dc = state.dc;
        var panel = state.panel;
        var width = state.width();
        var height = panel.height();
        var view = dc.view;
        var view1 = dc.view1;
        var view2 = dc.view2;
        var header1 = view1.children("div.datagrid-header");
        var header2 = view2.children("div.datagrid-header");
        var table1 = header1.find("table");
        var table2 = header2.find("table");
        view.width(width);
        var inner1 = header1.children("div.datagrid-header-inner").show();
        view1.width(inner1.find("table").width());
        if (!opts.showHeader) {
            inner1.hide();
        }
        view2.width(width - view1._outerWidth());
        view1.children()._outerWidth(view1.width());
        view2.children()._outerWidth(view2.width());
        var all = header1.add(header2).add(table1).add(table2);
        all.css("height", "");
        var hh = Math.max(table1.height(), table2.height());
        all._outerHeight(hh);
        dc.body1.add(dc.body2).children("table.datagrid-btable-frozen").css({
            position: "absolute",
            top: dc.header2._outerHeight()
        });
        var _33 = dc.body2.children("table.datagrid-btable-frozen")._outerHeight();
        var _34 = _33 + header2._outerHeight() + view2.children(".datagrid-footer")._outerHeight();
        panel.children(":not(.datagrid-view)").each(function () {
            _34 += $(this)._outerHeight();
        });
        var _35 = panel.outerHeight() - panel.height();
        var _36 = panel._size("minHeight") || "";
        var _37 = panel._size("maxHeight") || "";
        view1.add(view2).children("div.datagrid-body").css({
            marginTop: _33,
            height: (isNaN(parseInt(opts.height)) ? "" : (height - _34)),
            minHeight: (_36 ? _36 - _35 - _34 : ""),
            maxHeight: (_37 ? _37 - _35 - _34 : "")
        });
        view.height(view2.height());
    };
    function _38(_39, _3a, _3b) {
        var _3c = $.data(_39, "datagrid").data.rows;
        var _3d = $.data(_39, "datagrid").options;
        var dc = $.data(_39, "datagrid").dc;
        if (!dc.body1.is(":empty") && (!_3d.nowrap || _3d.autoRowHeight || _3b)) {
            if (_3a != undefined) {
                var tr1 = _3d.finder.getTr(_39, _3a, "body", 1);
                var tr2 = _3d.finder.getTr(_39, _3a, "body", 2);
                _3e(tr1, tr2);
            } else {
                var tr1 = _3d.finder.getTr(_39, 0, "allbody", 1);
                var tr2 = _3d.finder.getTr(_39, 0, "allbody", 2);
                _3e(tr1, tr2);
                if (_3d.showFooter) {
                    var tr1 = _3d.finder.getTr(_39, 0, "allfooter", 1);
                    var tr2 = _3d.finder.getTr(_39, 0, "allfooter", 2);
                    _3e(tr1, tr2);
                }
            }
        }
        _24(_39);
        if (_3d.height == "auto") {
            var _3f = dc.body1.parent();
            var _40 = dc.body2;
            var _41 = _42(_40);
            var _43 = _41.height;
            if (_41.width > _40.width()) {
                _43 += 18;
            }
            _43 -= parseInt(_40.css("marginTop")) || 0;
            _3f.height(_43);
            _40.height(_43);
            dc.view.height(dc.view2.height());
        }
        dc.body2.triggerHandler("scroll");
        function _3e(_44, _45) {
            for (var i = 0; i < _45.length; i++) {
                var tr1 = $(_44[i]);
                var tr2 = $(_45[i]);
                tr1.css("height", "");
                tr2.css("height", "");
                var _46 = Math.max(tr1.height(), tr2.height());
                tr1.css("height", _46);
                tr2.css("height", _46);
            }
        };
        function _42(cc) {
            var _47 = 0;
            var _48 = 0;
            $(cc).children().each(function () {
                var c = $(this);
                if (c.is(":visible")) {
                    _48 += c._outerHeight();
                    if (_47 < c._outerWidth()) {
                        _47 = c._outerWidth();
                    }
                }
            });
            return { width: _47, height: _48 };
        };
    };
    function _49(_4a, _4b) {
        var _4c = $.data(_4a, "datagrid");
        var _4d = _4c.options;
        var dc = _4c.dc;
        if (!dc.body2.children("table.datagrid-btable-frozen").length) {
            dc.body1.add(dc.body2).prepend("<table class=\"datagrid-btable datagrid-btable-frozen\" cellspacing=\"0\" cellpadding=\"0\"></table>");
        }
        _4e(true);
        _4e(false);
        _24(_4a);
        function _4e(_4f) {
            var _50 = _4f ? 1 : 2;
            var tr = _4d.finder.getTr(_4a, _4b, "body", _50);
            (_4f ? dc.body1 : dc.body2).children("table.datagrid-btable-frozen").append(tr);
        };
    };
    function _51(_52, _53) {
        function _54() {
            var _55 = [];
            var _56 = [];
            $(_52).children("thead").each(function () {
                var opt = $.parser.parseOptions(this, [{ frozen: "boolean" }]);
                $(this).find("tr").each(function () {
                    var _57 = [];
                    $(this).find("th").each(function () {
                        var th = $(this);
                        var col = $.extend({}, $.parser.parseOptions(this,
                            ["field", "align", "halign", "order", "width",
                                {
                                    sortable: "boolean", checkbox: "boolean", resizable: "boolean", fixed: "boolean"
                                },
                                {
                                    rowspan: "number", colspan: "number"
                                }
                            ]),
                            {
                                title: (th.html() || undefined), hidden: (th.attr("hidden") ? true : undefined),
                                formatter: (th.attr("formatter") ? eval(th.attr("formatter")) : undefined),
                                styler: (th.attr("styler") ? eval(th.attr("styler")) : undefined),
                                sorter: (th.attr("sorter") ? eval(th.attr("sorter")) : undefined)
                            });
                        if (col.width && String(col.width).indexOf("%") == -1) {
                            col.width = parseInt(col.width);
                        }
                        if (th.attr("editor")) {
                            var s = $.trim(th.attr("editor"));
                            if (s.substr(0, 1) == "{") {
                                col.editor = eval("(" + s + ")");
                            } else {
                                col.editor = s;
                            }
                        }
                        _57.push(col);
                    });
                    opt.frozen ? _55.push(_57) : _56.push(_57);
                });
            });
            return [_55, _56];
        };
        var _58 = $("<div class=\"datagrid-wrap\">" + "<div class=\"datagrid-view\">" + "<div class=\"datagrid-view1\">" + "<div class=\"datagrid-header\">" + "<div class=\"datagrid-header-inner\"></div>" + "</div>" + "<div class=\"datagrid-body\">" + "<div class=\"datagrid-body-inner\"></div>" + "</div>" + "<div class=\"datagrid-footer\">" + "<div class=\"datagrid-footer-inner\"></div>" + "</div>" + "</div>" + "<div class=\"datagrid-view2\">" + "<div class=\"datagrid-header\">" + "<div class=\"datagrid-header-inner\"></div>" + "</div>" + "<div class=\"datagrid-body\"></div>" + "<div class=\"datagrid-footer\">" + "<div class=\"datagrid-footer-inner\"></div>" + "</div>" + "</div>" + "</div>" + "</div>").insertAfter(_52);
        _58.panel({ doSize: false, cls: "datagrid" });
        $(_52).addClass("datagrid-f").hide().appendTo(_58.children("div.datagrid-view"));
        var cc = _54();
        var _59 = _58.children("div.datagrid-view");
        var _5a = _59.children("div.datagrid-view1");
        var _5b = _59.children("div.datagrid-view2");
        return { panel: _58, frozenColumns: cc[0], columns: cc[1], dc: { view: _59, view1: _5a, view2: _5b, header1: _5a.children("div.datagrid-header").children("div.datagrid-header-inner"), header2: _5b.children("div.datagrid-header").children("div.datagrid-header-inner"), body1: _5a.children("div.datagrid-body").children("div.datagrid-body-inner"), body2: _5b.children("div.datagrid-body"), footer1: _5a.children("div.datagrid-footer").children("div.datagrid-footer-inner"), footer2: _5b.children("div.datagrid-footer").children("div.datagrid-footer-inner") } };
    };
    function _5c(_5d) {
        var _5e = $.data(_5d, "datagrid");
        var _5f = _5e.options;
        var dc = _5e.dc;
        var _60 = _5e.panel;
        _5e.ss = $(_5d).datagrid("createStyleSheet");
        _60.panel($.extend({}, _5f, {
            id: null, doSize: false, onResize: function (_61, _62) {
                if ($.data(_5d, "datagrid")) {
                    _24(_5d);
                    $(_5d).datagrid("fitColumns");
                    _5f.onResize.call(_60, _61, _62);
                }
            }, onExpand: function () {
                _38(_5d);
                _5f.onExpand.call(_60);
            }
        }));
        _5e.rowIdPrefix = "datagrid-row-r" + (++_1);
        _5e.cellClassPrefix = "datagrid-cell-c" + _1;
        _63(dc.header1, _5f.frozenColumns, true);
        _63(dc.header2, _5f.columns, false);
        _64();
        dc.header1.add(dc.header2).css("display", _5f.showHeader ? "block" : "none");
        dc.footer1.add(dc.footer2).css("display", _5f.showFooter ? "block" : "none");
        if (_5f.toolbar) {
            if ($.isArray(_5f.toolbar)) {
                $("div.datagrid-toolbar", _60).remove();
                var tb = $("<div class=\"datagrid-toolbar\"><table cellspacing=\"0\" cellpadding=\"0\"><tr></tr></table></div>").prependTo(_60);
                var tr = tb.find("tr");
                for (var i = 0; i < _5f.toolbar.length; i++) {
                    var btn = _5f.toolbar[i];
                    if (btn == "-") {
                        $("<td><div class=\"datagrid-btn-separator\"></div></td>").appendTo(tr);
                    } else {
                        var td = $("<td></td>").appendTo(tr);
                        var _65 = $("<a href=\"javascript:void(0)\"></a>").appendTo(td);
                        _65[0].onclick = eval(btn.handler || function () {
                        });
                        _65.linkbutton($.extend({}, btn, { plain: true }));
                    }
                }
            } else {
                $(_5f.toolbar).addClass("datagrid-toolbar").prependTo(_60);
                $(_5f.toolbar).show();
            }
        } else {
            $("div.datagrid-toolbar", _60).remove();
        }
        $("div.datagrid-pager", _60).remove();
        if (_5f.pagination) {
            var _66 = $("<div class=\"datagrid-pager\"></div>");
            if (_5f.pagePosition == "bottom") {
                _66.appendTo(_60);
            } else {
                if (_5f.pagePosition == "top") {
                    _66.addClass("datagrid-pager-top").prependTo(_60);
                } else {
                    var _67 = $("<div class=\"datagrid-pager datagrid-pager-top\"></div>").prependTo(_60);
                    _66.appendTo(_60);
                    _66 = _66.add(_67);
                }
            }
            _66.pagination({
                total: (_5f.pageNumber * _5f.pageSize), pageNumber: _5f.pageNumber, pageSize: _5f.pageSize, pageList: _5f.pageList, onSelectPage: function (_68, _69) {
                    _5f.pageNumber = _68 || 1;
                    _5f.pageSize = _69;
                    _66.pagination("refresh", { pageNumber: _68, pageSize: _69 });
                    _b0(_5d);
                }
            });
            _5f.pageSize = _66.pagination("options").pageSize;
        }
        function _63(_6a, _6b, _6c) {
            if (!_6b) {
                return;
            }
            $(_6a).show();
            $(_6a).empty();
            var _6d = [];
            var _6e = [];
            if (_5f.sortName) {
                _6d = _5f.sortName.split(",");
                _6e = _5f.sortOrder.split(",");
            }
            var t = $("<table class=\"datagrid-htable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tbody></tbody></table>").appendTo(_6a);
            for (var i = 0; i < _6b.length; i++) {
                var tr = $("<tr class=\"datagrid-header-row\"></tr>").appendTo($("tbody", t));
                var _6f = _6b[i];
                for (var j = 0; j < _6f.length; j++) {
                    var col = _6f[j];
                    var _70 = "";
                    if (col.rowspan) {
                        _70 += "rowspan=\"" + col.rowspan + "\" ";
                    }
                    if (col.colspan) {
                        _70 += "colspan=\"" + col.colspan + "\" ";
                    }
                    var td = $("<td " + _70 + "></td>").appendTo(tr);
                    if (col.checkbox) {
                        td.attr("field", col.field);
                        $("<div class=\"datagrid-header-check\"></div>").html("<input type=\"checkbox\"/>").appendTo(td);
                    } else {
                        if (col.field) {
                            td.attr("field", col.field);
                            td.append("<div class=\"datagrid-cell\"><span></span><span class=\"datagrid-sort-icon\"></span></div>");
                            $("span", td).html(col.title);
                            $("span.datagrid-sort-icon", td).html("&nbsp;");
                            var _71 = td.find("div.datagrid-cell");
                            var pos = _2(_6d, col.field);
                            if (pos >= 0) {
                                _71.addClass("datagrid-sort-" + _6e[pos]);
                            }
                            if (col.resizable == false) {
                                _71.attr("resizable", "false");
                            }
                            if (col.width) {
                                var _72 = $.parser.parseValue("width", col.width, dc.view, _5f.scrollbarSize);
                                _71._outerWidth(_72 - 1);
                                col.boxWidth = parseInt(_71[0].style.width);
                                col.deltaWidth = _72 - col.boxWidth;
                            } else {
                                col.auto = true;
                            }
                            _71.css("text-align", (col.halign || col.align || ""));
                            col.cellClass = _5e.cellClassPrefix + "-" + col.field.replace(/[\.|\s]/g, "-");
                            _71.addClass(col.cellClass).css("width", "");
                        } else {
                            $("<div class=\"datagrid-cell-group\"></div>").html(col.title).appendTo(td);
                        }
                    }
                    if (col.hidden) {
                        td.hide();
                    }
                }
            }
            if (_6c && _5f.rownumbers) {
                var td = $("<td rowspan=\"" + _5f.frozenColumns.length + "\"><div class=\"datagrid-header-rownumber\"></div></td>");
                if ($("tr", t).length == 0) {
                    td.wrap("<tr class=\"datagrid-header-row\"></tr>").parent().appendTo($("tbody", t));
                } else {
                    td.prependTo($("tr:first", t));
                }
            }
        };
        function _64() {
            var _73 = [];
            var _74 = getColumnFields(_5d, true).concat(_75(_5d));
            for (var i = 0; i < _74.length; i++) {
                var col = _76(_5d, _74[i]);
                if (col && !col.checkbox) {
                    _73.push(["." + col.cellClass, col.boxWidth ? col.boxWidth + "px" : "auto"]);
                }
            }
            _5e.ss.add(_73);
            _5e.ss.dirty(_5e.cellSelectorPrefix);
            _5e.cellSelectorPrefix = "." + _5e.cellClassPrefix;
        };
    };
    function _77(_78) {
        var _79 = $.data(_78, "datagrid");
        var _7a = _79.panel;
        var _7b = _79.options;
        var dc = _79.dc;
        var _7c = dc.header1.add(dc.header2);
        _7c.find("input[type=checkbox]").unbind(".datagrid").bind("click.datagrid", function (e) {
            if (_7b.singleSelect && _7b.selectOnCheck) {
                return false;
            }
            if ($(this).is(":checked")) {
                _126(_78);
            } else {
                _12c(_78);
            }
            e.stopPropagation();
        });
        var _7d = _7c.find("div.datagrid-cell");
        _7d.closest("td").unbind(".datagrid").bind("mouseenter.datagrid", function () {
            if (_79.resizing) {
                return;
            }
            $(this).addClass("datagrid-header-over");
        }).bind("mouseleave.datagrid", function () {
            $(this).removeClass("datagrid-header-over");
        }).bind("contextmenu.datagrid", function (e) {
            var _7e = $(this).attr("field");
            _7b.onHeaderContextMenu.call(_78, e, _7e);
        });
        _7d.unbind(".datagrid").bind("click.datagrid", function (e) {
            var p1 = $(this).offset().left + 5;
            var p2 = $(this).offset().left + $(this)._outerWidth() - 5;
            if (e.pageX < p2 && e.pageX > p1) {
                _a4(_78, $(this).parent().attr("field"));
            }
        }).bind("dblclick.datagrid", function (e) {
            var p1 = $(this).offset().left + 5;
            var p2 = $(this).offset().left + $(this)._outerWidth() - 5;
            var _7f = _7b.resizeHandle == "right" ? (e.pageX > p2) : (_7b.resizeHandle == "left" ? (e.pageX < p1) : (e.pageX < p1 || e.pageX > p2));
            if (_7f) {
                var _80 = $(this).parent().attr("field");
                var col = _76(_78, _80);
                if (col.resizable == false) {
                    return;
                }
                $(_78).datagrid("autoSizeColumn", _80);
                col.auto = false;
            }
        });
        var _81 = _7b.resizeHandle == "right" ? "e" : (_7b.resizeHandle == "left" ? "w" : "e,w");
        _7d.each(function () {
            $(this).resizable({
                handles: _81,
                disabled: ($(this).attr("resizable") ? $(this).attr("resizable") == "false" : false),
                minWidth: 25,
                onStartResize: function (e) {
                    _79.resizing = true;
                    _7c.css("cursor", $("body").css("cursor"));
                    if (!_79.proxy) {
                        _79.proxy = $("<div class=\"datagrid-resize-proxy\"></div>").appendTo(dc.view);
                    }
                    _79.proxy.css({ left: e.pageX - $(_7a).offset().left - 1, display: "none" });
                    setTimeout(function () {
                        if (_79.proxy) {
                            _79.proxy.show();
                        }
                    }, 500);
                }, onResize: function (e) {
                    _79.proxy.css({ left: e.pageX - $(_7a).offset().left - 1, display: "block" });
                    return false;
                }, onStopResize: function (e) {
                    _7c.css("cursor", "");
                    $(this).css("height", "");
                    var _82 = $(this).parent().attr("field");
                    var col = _76(_78, _82);
                    col.width = $(this)._outerWidth();
                    col.boxWidth = col.width - col.deltaWidth;
                    col.auto = undefined;
                    $(this).css("width", "");
                    $(_78).datagrid("fixColumnSize", _82);
                    _79.proxy.remove();
                    _79.proxy = null;
                    if ($(this).parents("div:first.datagrid-header").parent().hasClass("datagrid-view1")) {
                        _24(_78);
                    }
                    $(_78).datagrid("fitColumns");
                    _7b.onResizeColumn.call(_78, _82, col.width);
                    setTimeout(function () {
                        _79.resizing = false;
                    }, 0);
                }
            });
        });
        var bb = dc.body1.add(dc.body2);
        bb.unbind();
        for (var _83 in _7b.rowEvents) {
            bb.bind(_83, _7b.rowEvents[_83]);
        }
        dc.body1.bind("mousewheel DOMMouseScroll", function (e) {
            var e1 = e.originalEvent || window.event;
            var _84 = e1.wheelDelta || e1.detail * (-1);
            var dg = $(e.target).closest("div.datagrid-view").children(".datagrid-f");
            var dc = dg.data("datagrid").dc;
            dc.body2.scrollTop(dc.body2.scrollTop() - _84);
        });
        dc.body2.bind("scroll", function () {
            var b1 = dc.view1.children("div.datagrid-body");
            b1.scrollTop($(this).scrollTop());
            var c1 = dc.body1.children(":first");
            var c2 = dc.body2.children(":first");
            if (c1.length && c2.length) {
                var _85 = c1.offset().top;
                var _86 = c2.offset().top;
                if (_85 != _86) {
                    b1.scrollTop(b1.scrollTop() + _85 - _86);
                }
            }
            dc.view2.children("div.datagrid-header,div.datagrid-footer")._scrollLeft($(this)._scrollLeft());
            dc.body2.children("table.datagrid-btable-frozen").css("left", -$(this)._scrollLeft());
        });
    };
    function _87(_88) {
        return function (e) {
            var tr = _89(e.target);
            if (!tr) {
                return;
            }
            var _8a = _8b(tr);
            if ($.data(_8a, "datagrid").resizing) {
                return;
            }
            var _8c = _8d(tr);
            if (_88) {
                _8e(_8a, _8c);
            } else {
                var _8f = $.data(_8a, "datagrid").options;
                _8f.finder.getTr(_8a, _8c).removeClass("datagrid-row-over");
            }
        };
    };
    function _90(e) {
        var tr = _89(e.target);
        if (!tr) {
            return;
        }
        var _91 = _8b(tr);
        var _92 = $.data(_91, "datagrid").options;
        var _93 = _8d(tr);
        var tt = $(e.target);
        if (tt.parent().hasClass("datagrid-cell-check")) {
            if (_92.singleSelect && _92.selectOnCheck) {
                tt._propAttr("checked", !tt.is(":checked"));
                _94(_91, _93);
            } else {
                if (tt.is(":checked")) {
                    tt._propAttr("checked", false);
                    _94(_91, _93);
                } else {
                    tt._propAttr("checked", true);
                    _95(_91, _93);
                }
            }
        } else {
            var row = _92.finder.getRow(_91, _93);
            var td = tt.closest("td[field]", tr);
            if (td.length) {
                var _96 = td.attr("field");
                _92.onClickCell.call(_91, _93, _96, row[_96]);
            }
            if (_92.singleSelect == true) {
                _97(_91, _93);
            } else {
                if (_92.ctrlSelect) {
                    if (e.ctrlKey) {
                        if (tr.hasClass("datagrid-row-selected")) {
                            _98(_91, _93);
                        } else {
                            _97(_91, _93);
                        }
                    } else {
                        if (e.shiftKey) {
                            $(_91).datagrid("clearSelections");
                            var _99 = Math.min(_92.lastSelectedIndex || 0, _93);
                            var _9a = Math.max(_92.lastSelectedIndex || 0, _93);
                            for (var i = _99; i <= _9a; i++) {
                                _97(_91, i);
                            }
                        } else {
                            $(_91).datagrid("clearSelections");
                            _97(_91, _93);
                            _92.lastSelectedIndex = _93;
                        }
                    }
                } else {
                    if (tr.hasClass("datagrid-row-selected")) {
                        _98(_91, _93);
                    } else {
                        _97(_91, _93);
                    }
                }
            }
            _92.onClickRow.apply(_91, _9(_91, [_93, row]));
        }
    };
    function _9b(e) {
        var tr = _89(e.target);
        if (!tr) {
            return;
        }
        var _9c = _8b(tr);
        var _9d = $.data(_9c, "datagrid").options;
        var _9e = _8d(tr);
        var row = _9d.finder.getRow(_9c, _9e);
        var td = $(e.target).closest("td[field]", tr);
        if (td.length) {
            var _9f = td.attr("field");
            _9d.onDblClickCell.call(_9c, _9e, _9f, row[_9f]);
        }
        _9d.onDblClickRow.apply(_9c, _9(_9c, [_9e, row]));
    };
    function _a0(e) {
        var tr = _89(e.target);
        if (!tr) {
            return;
        }
        var _a1 = _8b(tr);
        var _a2 = $.data(_a1, "datagrid").options;
        var _a3 = _8d(tr);
        var row = _a2.finder.getRow(_a1, _a3);
        _a2.onRowContextMenu.call(_a1, e, _a3, row);
    };
    function _8b(t) {
        return $(t).closest("div.datagrid-view").children(".datagrid-f")[0];
    };
    function _89(t) {
        var tr = $(t).closest("tr.datagrid-row");
        if (tr.length && tr.parent().length) {
            return tr;
        } else {
            return undefined;
        }
    };
    function _8d(tr) {
        if (tr.attr("datagrid-row-index")) {
            return parseInt(tr.attr("datagrid-row-index"));
        } else {
            return tr.attr("node-id");
        }
    };
    function _a4(_a5, _a6) {
        var _a7 = $.data(_a5, "datagrid");
        var _a8 = _a7.options;
        _a6 = _a6 || {};
        var _a9 = { sortName: _a8.sortName, sortOrder: _a8.sortOrder };
        if (typeof _a6 == "object") {
            $.extend(_a9, _a6);
        }
        var _aa = [];
        var _ab = [];
        if (_a9.sortName) {
            _aa = _a9.sortName.split(",");
            _ab = _a9.sortOrder.split(",");
        }
        if (typeof _a6 == "string") {
            var _ac = _a6;
            var col = _76(_a5, _ac);
            if (!col.sortable || _a7.resizing) {
                return;
            }
            var _ad = col.order || "asc";
            var pos = _2(_aa, _ac);
            if (pos >= 0) {
                var _ae = _ab[pos] == "asc" ? "desc" : "asc";
                if (_a8.multiSort && _ae == _ad) {
                    _aa.splice(pos, 1);
                    _ab.splice(pos, 1);
                } else {
                    _ab[pos] = _ae;
                }
            } else {
                if (_a8.multiSort) {
                    _aa.push(_ac);
                    _ab.push(_ad);
                } else {
                    _aa = [_ac];
                    _ab = [_ad];
                }
            }
            _a9.sortName = _aa.join(",");
            _a9.sortOrder = _ab.join(",");
        }
        if (_a8.onBeforeSortColumn.call(_a5, _a9.sortName, _a9.sortOrder) == false) {
            return;
        }
        $.extend(_a8, _a9);
        var dc = _a7.dc;
        var _af = dc.header1.add(dc.header2);
        _af.find("div.datagrid-cell").removeClass("datagrid-sort-asc datagrid-sort-desc");
        for (var i = 0; i < _aa.length; i++) {
            var col = _76(_a5, _aa[i]);
            _af.find("div." + col.cellClass).addClass("datagrid-sort-" + _ab[i]);
        }
        if (_a8.remoteSort) {
            _b0(_a5);
        } else {
            _b1(_a5, $(_a5).datagrid("getData"));
        }
        _a8.onSortColumn.call(_a5, _a8.sortName, _a8.sortOrder);
    };
    function _b2(_b3) {
        var _b4 = $.data(_b3, "datagrid");
        var _b5 = _b4.options;
        var dc = _b4.dc;
        var _b6 = dc.view2.children("div.datagrid-header");
        dc.body2.css("overflow-x", "");
        _b7();
        _b8();
        _b9();
        _b7(true);
        if (_b6.width() >= _b6.find("table").width()) {
            dc.body2.css("overflow-x", "hidden");
        }
        function _b9() {
            if (!_b5.fitColumns) {
                return;
            }
            if (!_b4.leftWidth) {
                _b4.leftWidth = 0;
            }
            var _ba = 0;
            var cc = [];
            var _bb = getColumnFields(_b3, false);
            for (var i = 0; i < _bb.length; i++) {
                var col = _76(_b3, _bb[i]);
                if (_bc(col)) {
                    _ba += col.width;
                    cc.push({ field: col.field, col: col, addingWidth: 0 });
                }
            }
            if (!_ba) {
                return;
            }
            cc[cc.length - 1].addingWidth -= _b4.leftWidth;
            var _bd = _b6.children("div.datagrid-header-inner").show();
            var _be = _b6.width() - _b6.find("table").width() - _b5.scrollbarSize + _b4.leftWidth;
            var _bf = _be / _ba;
            if (!_b5.showHeader) {
                _bd.hide();
            }
            for (var i = 0; i < cc.length; i++) {
                var c = cc[i];
                var _c0 = parseInt(c.col.width * _bf);
                c.addingWidth += _c0;
                _be -= _c0;
            }
            cc[cc.length - 1].addingWidth += _be;
            for (var i = 0; i < cc.length; i++) {
                var c = cc[i];
                if (c.col.boxWidth + c.addingWidth > 0) {
                    c.col.boxWidth += c.addingWidth;
                    c.col.width += c.addingWidth;
                }
            }
            _b4.leftWidth = _be;
            $(_b3).datagrid("fixColumnSize");
        };
        function _b8() {
            var _c1 = false;
            var _c2 = getColumnFields(_b3, true).concat(getColumnFields(_b3, false));
            $.map(_c2, function (_c3) {
                var col = _76(_b3, _c3);
                if (String(col.width || "").indexOf("%") >= 0) {
                    var _c4 = $.parser.parseValue("width", col.width, dc.view, _b5.scrollbarSize) - col.deltaWidth;
                    if (_c4 > 0) {
                        col.boxWidth = _c4;
                        _c1 = true;
                    }
                }
            });
            if (_c1) {
                $(_b3).datagrid("fixColumnSize");
            }
        };
        function _b7(fit) {
            var _c5 = dc.header1.add(dc.header2).find(".datagrid-cell-group");
            if (_c5.length) {
                _c5.each(function () {
                    $(this)._outerWidth(fit ? $(this).parent().width() : 10);
                });
                if (fit) {
                    _24(_b3);
                }
            }
        };
        function _bc(col) {
            if (String(col.width || "").indexOf("%") >= 0) {
                return false;
            }
            if (!col.hidden && !col.checkbox && !col.auto && !col.fixed) {
                return true;
            }
        };
    };
    function _c6(_c7, _c8) {
        var _c9 = $.data(_c7, "datagrid");
        var _ca = _c9.options;
        var dc = _c9.dc;
        var tmp = $("<div class=\"datagrid-cell\" style=\"position:absolute;left:-9999px\"></div>").appendTo("body");
        if (_c8) {
            _1e(_c8);
            if (_ca.fitColumns) {
                _24(_c7);
                $(_c7).datagrid("fitColumns");
            }
        } else {
            var _cb = false;
            var _cc = getColumnFields(_c7, true).concat(getColumnFields(_c7, false));
            for (var i = 0; i < _cc.length; i++) {
                var _c8 = _cc[i];
                var col = _76(_c7, _c8);
                if (col.auto) {
                    _1e(_c8);
                    _cb = true;
                }
            }
            if (_cb && _ca.fitColumns) {
                _24(_c7);
                $(_c7).datagrid("fitColumns");
            }
        }
        tmp.remove();
        function _1e(_cd) {
            var _ce = dc.view.find("div.datagrid-header td[field=\"" + _cd + "\"] div.datagrid-cell");
            _ce.css("width", "");
            var col = $(_c7).datagrid("getColumnOption", _cd);
            col.width = undefined;
            col.boxWidth = undefined;
            col.auto = true;
            $(_c7).datagrid("fixColumnSize", _cd);
            var _cf = Math.max(_d0("header"), _d0("allbody"), _d0("allfooter")) + 1;
            _ce._outerWidth(_cf - 1);
            col.width = _cf;
            col.boxWidth = parseInt(_ce[0].style.width);
            col.deltaWidth = _cf - col.boxWidth;
            _ce.css("width", "");
            $(_c7).datagrid("fixColumnSize", _cd);
            _ca.onResizeColumn.call(_c7, _cd, col.width);
            function _d0(_d1) {
                var _d2 = 0;
                if (_d1 == "header") {
                    _d2 = _d3(_ce);
                } else {
                    _ca.finder.getTr(_c7, 0, _d1).find("td[field=\"" + _cd + "\"] div.datagrid-cell").each(function () {
                        var w = _d3($(this));
                        if (_d2 < w) {
                            _d2 = w;
                        }
                    });
                }
                return _d2;
                function _d3(_d4) {
                    return _d4.is(":visible") ? _d4._outerWidth() : tmp.html(_d4.html())._outerWidth();
                };
            };
        };
    };
    function _d5(_d6, _d7) {
        var _d8 = $.data(_d6, "datagrid");
        var _d9 = _d8.options;
        var dc = _d8.dc;
        var _da = dc.view.find("table.datagrid-btable,table.datagrid-ftable");
        _da.css("table-layout", "fixed");
        if (_d7) {
            fix(_d7);
        } else {
            var ff = getColumnFields(_d6, true).concat(getColumnFields(_d6, false));
            for (var i = 0; i < ff.length; i++) {
                fix(ff[i]);
            }
        }
        _da.css("table-layout", "");
        _db(_d6);
        _38(_d6);
        _dc(_d6);
        function fix(_dd) {
            var col = _76(_d6, _dd);
            if (col.cellClass) {
                _d8.ss.set("." + col.cellClass, col.boxWidth ? col.boxWidth + "px" : "auto");
            }
        };
    };
    function _db(_de) {
        var dc = $.data(_de, "datagrid").dc;
        dc.view.find("td.datagrid-td-merged").each(function () {
            var td = $(this);
            var _df = td.attr("colspan") || 1;
            var col = _76(_de, td.attr("field"));
            var _e0 = col.boxWidth + col.deltaWidth - 1;
            for (var i = 1; i < _df; i++) {
                td = td.next();
                col = _76(_de, td.attr("field"));
                _e0 += col.boxWidth + col.deltaWidth;
            }
            $(this).children("div.datagrid-cell")._outerWidth(_e0);
        });
    };
    function _dc(_e1) {
        var dc = $.data(_e1, "datagrid").dc;
        dc.view.find("div.datagrid-editable").each(function () {
            var _e2 = $(this);
            var _e3 = _e2.parent().attr("field");
            var col = $(_e1).datagrid("getColumnOption", _e3);
            _e2._outerWidth(col.boxWidth + col.deltaWidth - 1);
            var ed = $.data(this, "datagrid.editor");
            if (ed.actions.resize) {
                ed.actions.resize(ed.target, _e2.width());
            }
        });
    };
    function _76(_e4, _e5) {
        function _e6(_e7) {
            if (_e7) {
                for (var i = 0; i < _e7.length; i++) {
                    var cc = _e7[i];
                    for (var j = 0; j < cc.length; j++) {
                        var c = cc[j];
                        if (c.field == _e5) {
                            return c;
                        }
                    }
                }
            }
            return null;
        };
        var _e8 = $.data(_e4, "datagrid").options;
        var col = _e6(_e8.columns);
        if (!col) {
            col = _e6(_e8.frozenColumns);
        }
        return col;
    };
    function getColumnFields(target, frozen) {
        var opts = $.data(target, "datagrid").options;
        var columns = (frozen == true) ? (opts.frozenColumns || [[]]) : opts.columns;
        if (columns.length == 0) {
            return [];
        }
        var aa = [];
        var columnsLength = getColumnsLength();
        for (var i = 0; i < columns.length; i++) {
            aa[i] = new Array(columnsLength);
        }
        for (var headerRowIndex = 0; headerRowIndex < columns.length; headerRowIndex++) {
            $.map(columns[headerRowIndex], function (col) {
                var _f0 = _f1(aa[headerRowIndex]);
                if (_f0 >= 0) {
                    var field = col.field || "";
                    for (var c = 0; c < (col.colspan || 1) ; c++) {
                        for (var r = 0; r < (col.rowspan || 1) ; r++) {
                            aa[headerRowIndex + r][_f0] = field;
                        }
                        _f0++;
                    }
                }
            });
        }
        return aa[aa.length - 1];
        function getColumnsLength() {
            var length = 0;
            $.map(columns[0], function (col) {
                length += col.colspan || 1;
            });
            return length;
        };
        function _f1(a) {
            for (var i = 0; i < a.length; i++) {
                if (a[i] == undefined) {
                    return i;
                }
            }
            return -1;
        };
    };
    function _b1(_f4, _f5) {
        var _f6 = $.data(_f4, "datagrid");
        var _f7 = _f6.options;
        var dc = _f6.dc;
        _f5 = _f7.loadFilter.call(_f4, _f5);
        _f5.total = parseInt(_f5.total);
        _f6.data = _f5;
        if (_f5.footer) {
            _f6.footer = _f5.footer;
        }
        if (!_f7.remoteSort && _f7.sortName) {
            var _f8 = _f7.sortName.split(",");
            var _f9 = _f7.sortOrder.split(",");
            _f5.rows.sort(function (r1, r2) {
                var r = 0;
                for (var i = 0; i < _f8.length; i++) {
                    var sn = _f8[i];
                    var so = _f9[i];
                    var col = _76(_f4, sn);
                    var _fa = col.sorter || function (a, b) {
                        return a == b ? 0 : (a > b ? 1 : -1);
                    };
                    r = _fa(r1[sn], r2[sn]) * (so == "asc" ? 1 : -1);
                    if (r != 0) {
                        return r;
                    }
                }
                return r;
            });
        }
        if (_f7.view.onBeforeRender) {
            _f7.view.onBeforeRender.call(_f7.view, _f4, _f5.rows);
        }
        _f7.view.render.call(_f7.view, _f4, dc.body2, false);
        _f7.view.render.call(_f7.view, _f4, dc.body1, true);
        if (_f7.showFooter) {
            _f7.view.renderFooter.call(_f7.view, _f4, dc.footer2, false);
            _f7.view.renderFooter.call(_f7.view, _f4, dc.footer1, true);
        }
        if (_f7.view.onAfterRender) {
            _f7.view.onAfterRender.call(_f7.view, _f4);
        }
        _f6.ss.clean();
        var _fb = $(_f4).datagrid("getPager");
        if (_fb.length) {
            var _fc = _fb.pagination("options");
            if (_fc.total != _f5.total) {
                _fb.pagination("refresh", { total: _f5.total });
                if (_f7.pageNumber != _fc.pageNumber && _fc.pageNumber > 0) {
                    _f7.pageNumber = _fc.pageNumber;
                    _b0(_f4);
                }
            }
        }
        _38(_f4);
        dc.body2.triggerHandler("scroll");
        $(_f4).datagrid("setSelectionState");
        $(_f4).datagrid("autoSizeColumn");
        _f7.onLoadSuccess.call(_f4, _f5);
    };
    function _fd(_fe) {
        var _ff = $.data(_fe, "datagrid");
        var opts = _ff.options;
        var dc = _ff.dc;
        dc.header1.add(dc.header2).find("input[type=checkbox]")._propAttr("checked", false);
        if (opts.idField) {
            var _100 = $.data(_fe, "treegrid") ? true : false;
            var _101 = opts.onSelect;
            var _102 = opts.onCheck;
            opts.onSelect = opts.onCheck = function () {
            };
            var rows = opts.finder.getRows(_fe);
            for (var i = 0; i < rows.length; i++) {
                var row = rows[i];
                var _103 = _100 ? row[opts.idField] : i;
                if (_104(_ff.selectedRows, row)) {
                    _97(_fe, _103, true);
                }
                if (_104(_ff.checkedRows, row)) {
                    _94(_fe, _103, true);
                }
            }
            opts.onSelect = _101;
            opts.onCheck = _102;
        }
        function _104(a, r) {
            for (var i = 0; i < a.length; i++) {
                if (a[i][opts.idField] == r[opts.idField]) {
                    a[i] = r;
                    return true;
                }
            }
            return false;
        };
    };
    function getRowIndex(target, row) {
        var state = $.data(target, "datagrid");
        var opts = state.options;
        var rows = state.data.rows;
        if (typeof row == "object") {
            return _2(rows, row);
        } else {
            for (var i = 0; i < rows.length; i++) {
                if (rows[i][opts.idField] == row) {
                    return i;
                }
            }
            return -1;
        }
    };
    function _108(_109) {
        var _10a = $.data(_109, "datagrid");
        var opts = _10a.options;
        var data = _10a.data;
        if (opts.idField) {
            return _10a.selectedRows;
        } else {
            var rows = [];
            opts.finder.getTr(_109, "", "selected", 2).each(function () {
                rows.push(opts.finder.getRow(_109, $(this)));
            });
            return rows;
        }
    };
    function _10b(target) {
        var state = $.data(target, "datagrid");
        var opts = state.options;
        if (opts.idField) {
            return state.checkedRows;
        } else {
            var rows = [];
            opts.finder.getTr(target, "", "checked", 2).each(function () {
                rows.push(opts.finder.getRow(target, $(this)));
            });
            return rows;
        }
    };
    function _10e(_10f, _110) {
        var _111 = $.data(_10f, "datagrid");
        var dc = _111.dc;
        var opts = _111.options;
        var tr = opts.finder.getTr(_10f, _110);
        if (tr.length) {
            if (tr.closest("table").hasClass("datagrid-btable-frozen")) {
                return;
            }
            var _112 = dc.view2.children("div.datagrid-header")._outerHeight();
            var _113 = dc.body2;
            var _114 = _113.outerHeight(true) - _113.outerHeight();
            var top = tr.position().top - _112 - _114;
            if (top < 0) {
                _113.scrollTop(_113.scrollTop() + top);
            } else {
                if (top + tr._outerHeight() > _113.height() - 18) {
                    _113.scrollTop(_113.scrollTop() + top + tr._outerHeight() - _113.height() + 18);
                }
            }
        }
    };
    function _8e(_115, _116) {
        var _117 = $.data(_115, "datagrid");
        var opts = _117.options;
        opts.finder.getTr(_115, _117.highlightIndex).removeClass("datagrid-row-over");
        opts.finder.getTr(_115, _116).addClass("datagrid-row-over");
        _117.highlightIndex = _116;
    };
    function _97(_118, _119, _11a) {
        var _11b = $.data(_118, "datagrid");
        var opts = _11b.options;
        var row = opts.finder.getRow(_118, _119);
        if (opts.onBeforeSelect.apply(_118, _9(_118, [_119, row])) == false) {
            return;
        }
        if (opts.singleSelect) {
            _11c(_118, true);
            _11b.selectedRows = [];
        }
        if (!_11a && opts.checkOnSelect) {
            _94(_118, _119, true);
        }
        if (opts.idField) {
            _7(_11b.selectedRows, opts.idField, row);
        }
        opts.finder.getTr(_118, _119).addClass("datagrid-row-selected");
        opts.onSelect.apply(_118, _9(_118, [_119, row]));
        _10e(_118, _119);
    };
    function _98(_11d, _11e, _11f) {
        var _120 = $.data(_11d, "datagrid");
        var dc = _120.dc;
        var opts = _120.options;
        var row = opts.finder.getRow(_11d, _11e);
        if (opts.onBeforeUnselect.apply(_11d, _9(_11d, [_11e, row])) == false) {
            return;
        }
        if (!_11f && opts.checkOnSelect) {
            _95(_11d, _11e, true);
        }
        opts.finder.getTr(_11d, _11e).removeClass("datagrid-row-selected");
        if (opts.idField) {
            _4(_120.selectedRows, opts.idField, row[opts.idField]);
        }
        opts.onUnselect.apply(_11d, _9(_11d, [_11e, row]));
    };
    function _121(_122, _123) {
        var _124 = $.data(_122, "datagrid");
        var opts = _124.options;
        var rows = opts.finder.getRows(_122);
        var _125 = $.data(_122, "datagrid").selectedRows;
        if (!_123 && opts.checkOnSelect) {
            _126(_122, true);
        }
        opts.finder.getTr(_122, "", "allbody").addClass("datagrid-row-selected");
        if (opts.idField) {
            for (var _127 = 0; _127 < rows.length; _127++) {
                _7(_125, opts.idField, rows[_127]);
            }
        }
        opts.onSelectAll.call(_122, rows);
    };
    function _11c(_128, _129) {
        var _12a = $.data(_128, "datagrid");
        var opts = _12a.options;
        var rows = opts.finder.getRows(_128);
        var _12b = $.data(_128, "datagrid").selectedRows;
        if (!_129 && opts.checkOnSelect) {
            _12c(_128, true);
        }
        opts.finder.getTr(_128, "", "selected").removeClass("datagrid-row-selected");
        if (opts.idField) {
            for (var _12d = 0; _12d < rows.length; _12d++) {
                _4(_12b, opts.idField, rows[_12d][opts.idField]);
            }
        }
        opts.onUnselectAll.call(_128, rows);
    };
    function _94(_12e, _12f, _130) {
        var _131 = $.data(_12e, "datagrid");
        var opts = _131.options;
        var row = opts.finder.getRow(_12e, _12f);
        if (opts.onBeforeCheck.apply(_12e, _9(_12e, [_12f, row])) == false) {
            return;
        }
        if (opts.singleSelect && opts.selectOnCheck) {
            _12c(_12e, true);
            _131.checkedRows = [];
        }
        if (!_130 && opts.selectOnCheck) {
            _97(_12e, _12f, true);
        }
        var tr = opts.finder.getTr(_12e, _12f).addClass("datagrid-row-checked");
        tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked", true);
        tr = opts.finder.getTr(_12e, "", "checked", 2);
        if (tr.length == opts.finder.getRows(_12e).length) {
            var dc = _131.dc;
            dc.header1.add(dc.header2).find("input[type=checkbox]")._propAttr("checked", true);
        }
        if (opts.idField) {
            _7(_131.checkedRows, opts.idField, row);
        }
        opts.onCheck.apply(_12e, _9(_12e, [_12f, row]));
    };
    function _95(_132, _133, _134) {
        var _135 = $.data(_132, "datagrid");
        var opts = _135.options;
        var row = opts.finder.getRow(_132, _133);
        if (opts.onBeforeUncheck.apply(_132, _9(_132, [_133, row])) == false) {
            return;
        }
        if (!_134 && opts.selectOnCheck) {
            _98(_132, _133, true);
        }
        var tr = opts.finder.getTr(_132, _133).removeClass("datagrid-row-checked");
        tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked", false);
        var dc = _135.dc;
        var _136 = dc.header1.add(dc.header2);
        _136.find("input[type=checkbox]")._propAttr("checked", false);
        if (opts.idField) {
            _4(_135.checkedRows, opts.idField, row[opts.idField]);
        }
        opts.onUncheck.apply(_132, _9(_132, [_133, row]));
    };
    function _126(_137, _138) {
        var _139 = $.data(_137, "datagrid");
        var opts = _139.options;
        var rows = opts.finder.getRows(_137);
        if (!_138 && opts.selectOnCheck) {
            _121(_137, true);
        }
        var dc = _139.dc;
        var hck = dc.header1.add(dc.header2).find("input[type=checkbox]");
        var bck = opts.finder.getTr(_137, "", "allbody").addClass("datagrid-row-checked").find("div.datagrid-cell-check input[type=checkbox]");
        hck.add(bck)._propAttr("checked", true);
        if (opts.idField) {
            for (var i = 0; i < rows.length; i++) {
                _7(_139.checkedRows, opts.idField, rows[i]);
            }
        }
        opts.onCheckAll.call(_137, rows);
    };
    function _12c(_13a, _13b) {
        var _13c = $.data(_13a, "datagrid");
        var opts = _13c.options;
        var rows = opts.finder.getRows(_13a);
        if (!_13b && opts.selectOnCheck) {
            _11c(_13a, true);
        }
        var dc = _13c.dc;
        var hck = dc.header1.add(dc.header2).find("input[type=checkbox]");
        var bck = opts.finder.getTr(_13a, "", "checked").removeClass("datagrid-row-checked").find("div.datagrid-cell-check input[type=checkbox]");
        hck.add(bck)._propAttr("checked", false);
        if (opts.idField) {
            for (var i = 0; i < rows.length; i++) {
                _4(_13c.checkedRows, opts.idField, rows[i][opts.idField]);
            }
        }
        opts.onUncheckAll.call(_13a, rows);
    };
    function _13d(_13e, _13f) {
        var opts = $.data(_13e, "datagrid").options;
        var tr = opts.finder.getTr(_13e, _13f);
        var row = opts.finder.getRow(_13e, _13f);
        if (tr.hasClass("datagrid-row-editing")) {
            return;
        }
        if (opts.onBeforeEdit.apply(_13e, _9(_13e, [_13f, row])) == false) {
            return;
        }
        tr.addClass("datagrid-row-editing");
        _140(_13e, _13f);
        _dc(_13e);
        tr.find("div.datagrid-editable").each(function () {
            var _141 = $(this).parent().attr("field");
            var ed = $.data(this, "datagrid.editor");
            ed.actions.setValue(ed.target, row[_141]);
        });
        _142(_13e, _13f);
        opts.onBeginEdit.apply(_13e, _9(_13e, [_13f, row]));
    };
    function _143(_144, _145, _146) {
        var _147 = $.data(_144, "datagrid");
        var opts = _147.options;
        var _148 = _147.updatedRows;
        var _149 = _147.insertedRows;
        var tr = opts.finder.getTr(_144, _145);
        var row = opts.finder.getRow(_144, _145);
        if (!tr.hasClass("datagrid-row-editing")) {
            return;
        }
        if (!_146) {
            if (!_142(_144, _145)) {
                return;
            }
            var _14a = false;
            var _14b = {};
            tr.find("div.datagrid-editable").each(function () {
                var _14c = $(this).parent().attr("field");
                var ed = $.data(this, "datagrid.editor");
                var t = $(ed.target);
                var _14d = t.data("textbox") ? t.textbox("textbox") : t;
                _14d.triggerHandler("blur");
                var _14e = ed.actions.getValue(ed.target);
                if (row[_14c] != _14e) {
                    row[_14c] = _14e;
                    _14a = true;
                    _14b[_14c] = _14e;
                }
            });
            if (_14a) {
                if (_2(_149, row) == -1) {
                    if (_2(_148, row) == -1) {
                        _148.push(row);
                    }
                }
            }
            opts.onEndEdit.apply(_144, _9(_144, [_145, row, _14b]));
        }
        tr.removeClass("datagrid-row-editing");
        _14f(_144, _145);
        $(_144).datagrid("refreshRow", _145);
        if (!_146) {
            opts.onAfterEdit.apply(_144, _9(_144, [_145, row, _14b]));
        } else {
            opts.onCancelEdit.apply(_144, _9(_144, [_145, row]));
        }
    };
    function _150(_151, _152) {
        var opts = $.data(_151, "datagrid").options;
        var tr = opts.finder.getTr(_151, _152);
        var _153 = [];
        tr.children("td").each(function () {
            var cell = $(this).find("div.datagrid-editable");
            if (cell.length) {
                var ed = $.data(cell[0], "datagrid.editor");
                _153.push(ed);
            }
        });
        return _153;
    };
    function _154(_155, _156) {
        var _157 = _150(_155, _156.index != undefined ? _156.index : _156.id);
        for (var i = 0; i < _157.length; i++) {
            if (_157[i].field == _156.field) {
                return _157[i];
            }
        }
        return null;
    };
    function _140(_158, _159) {
        var opts = $.data(_158, "datagrid").options;
        var tr = opts.finder.getTr(_158, _159);
        tr.children("td").each(function () {
            var cell = $(this).find("div.datagrid-cell");
            var _15a = $(this).attr("field");
            var col = _76(_158, _15a);
            if (col && col.editor) {
                var _15b, _15c;
                if (typeof col.editor == "string") {
                    _15b = col.editor;
                } else {
                    _15b = col.editor.type;
                    _15c = col.editor.options;
                }
                var _15d = opts.editors[_15b];
                if (_15d) {
                    var _15e = cell.html();
                    var _15f = cell._outerWidth();
                    cell.addClass("datagrid-editable");
                    cell._outerWidth(_15f);
                    cell.html("<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\"><tr><td></td></tr></table>");
                    cell.children("table").bind("click dblclick contextmenu", function (e) {
                        e.stopPropagation();
                    });
                    $.data(cell[0], "datagrid.editor", { actions: _15d, target: _15d.init(cell.find("td"), _15c), field: _15a, type: _15b, oldHtml: _15e });
                }
            }
        });
        _38(_158, _159, true);
    };
    function _14f(_160, _161) {
        var opts = $.data(_160, "datagrid").options;
        var tr = opts.finder.getTr(_160, _161);
        tr.children("td").each(function () {
            var cell = $(this).find("div.datagrid-editable");
            if (cell.length) {
                var ed = $.data(cell[0], "datagrid.editor");
                if (ed.actions.destroy) {
                    ed.actions.destroy(ed.target);
                }
                cell.html(ed.oldHtml);
                $.removeData(cell[0], "datagrid.editor");
                cell.removeClass("datagrid-editable");
                cell.css("width", "");
            }
        });
    };
    function _142(_162, _163) {
        var tr = $.data(_162, "datagrid").options.finder.getTr(_162, _163);
        if (!tr.hasClass("datagrid-row-editing")) {
            return true;
        }
        var vbox = tr.find(".validatebox-text");
        vbox.validatebox("validate");
        vbox.trigger("mouseleave");
        var _164 = tr.find(".validatebox-invalid");
        return _164.length == 0;
    };
    function _165(_166, _167) {
        var _168 = $.data(_166, "datagrid").insertedRows;
        var _169 = $.data(_166, "datagrid").deletedRows;
        var _16a = $.data(_166, "datagrid").updatedRows;
        if (!_167) {
            var rows = [];
            rows = rows.concat(_168);
            rows = rows.concat(_169);
            rows = rows.concat(_16a);
            return rows;
        } else {
            if (_167 == "inserted") {
                return _168;
            } else {
                if (_167 == "deleted") {
                    return _169;
                } else {
                    if (_167 == "updated") {
                        return _16a;
                    }
                }
            }
        }
        return [];
    };
    function deleteRow(target, index) {
        var state = $.data(target, "datagrid");
        var opts = state.options;
        var data = state.data;
        var _16f = state.insertedRows;
        var _170 = state.deletedRows;
        $(target).datagrid("cancelEdit", index);
        var row = opts.finder.getRow(target, index);
        if (_2(_16f, row) >= 0) {
            _4(_16f, row);
        } else {
            _170.push(row);
        }
        _4(state.selectedRows, opts.idField, row[opts.idField]);
        _4(state.checkedRows, opts.idField, row[opts.idField]);
        opts.view.deleteRow.call(opts.view, target, index);
        if (opts.height == "auto") {
            _38(target);
        }
        $(target).datagrid("getPager").pagination("refresh", { total: data.total });
    };
    function _171(_172, _173) {
        var data = $.data(_172, "datagrid").data;
        var view = $.data(_172, "datagrid").options.view;
        var _174 = $.data(_172, "datagrid").insertedRows;
        view.insertRow.call(view, _172, _173.index, _173.row);
        _174.push(_173.row);
        $(_172).datagrid("getPager").pagination("refresh", { total: data.total });
    };
    function _175(_176, row) {
        var data = $.data(_176, "datagrid").data;
        var view = $.data(_176, "datagrid").options.view;
        var _177 = $.data(_176, "datagrid").insertedRows;
        view.insertRow.call(view, _176, null, row);
        _177.push(row);
        $(_176).datagrid("getPager").pagination("refresh", { total: data.total });
    };
    function _178(_179) {
        var _17a = $.data(_179, "datagrid");
        var data = _17a.data;
        var rows = data.rows;
        var _17b = [];
        for (var i = 0; i < rows.length; i++) {
            _17b.push($.extend({}, rows[i]));
        }
        _17a.originalRows = _17b;
        _17a.updatedRows = [];
        _17a.insertedRows = [];
        _17a.deletedRows = [];
    };
    function _17c(_17d) {
        var data = $.data(_17d, "datagrid").data;
        var ok = true;
        for (var i = 0, len = data.rows.length; i < len; i++) {
            if (_142(_17d, i)) {
                $(_17d).datagrid("endEdit", i);
            } else {
                ok = false;
            }
        }
        if (ok) {
            _178(_17d);
        }
    };
    function _17e(_17f) {
        var _180 = $.data(_17f, "datagrid");
        var opts = _180.options;
        var _181 = _180.originalRows;
        var _182 = _180.insertedRows;
        var _183 = _180.deletedRows;
        var _184 = _180.selectedRows;
        var _185 = _180.checkedRows;
        var data = _180.data;
        function _186(a) {
            var ids = [];
            for (var i = 0; i < a.length; i++) {
                ids.push(a[i][opts.idField]);
            }
            return ids;
        };
        function _187(ids, _188) {
            for (var i = 0; i < ids.length; i++) {
                var _189 = getRowIndex(_17f, ids[i]);
                if (_189 >= 0) {
                    (_188 == "s" ? _97 : _94)(_17f, _189, true);
                }
            }
        };
        for (var i = 0; i < data.rows.length; i++) {
            $(_17f).datagrid("cancelEdit", i);
        }
        var _18a = _186(_184);
        var _18b = _186(_185);
        _184.splice(0, _184.length);
        _185.splice(0, _185.length);
        data.total += _183.length - _182.length;
        data.rows = _181;
        _b1(_17f, data);
        _187(_18a, "s");
        _187(_18b, "c");
        _178(_17f);
    };
    function _b0(_18c, _18d) {
        var opts = $.data(_18c, "datagrid").options;
        if (_18d) {
            opts.queryParams = _18d;
        }
        var _18e = $.extend({}, opts.queryParams);
        if (opts.pagination) {
            $.extend(_18e, { page: opts.pageNumber || 1, rows: opts.pageSize });
        }
        if (opts.sortName) {
            $.extend(_18e, { sort: opts.sortName, order: opts.sortOrder });
        }
        if (opts.onBeforeLoad.call(_18c, _18e) == false) {
            return;
        }
        $(_18c).datagrid("loading");
        var _18f = opts.loader.call(_18c, _18e, function (data) {
            $(_18c).datagrid("loaded");
            $(_18c).datagrid("loadData", data);
        }, function () {
            $(_18c).datagrid("loaded");
            opts.onLoadError.apply(_18c, arguments);
        });
        if (_18f == false) {
            $(_18c).datagrid("loaded");
        }
    };
    function _190(_191, _192) {
        var opts = $.data(_191, "datagrid").options;
        _192.type = _192.type || "body";
        _192.rowspan = _192.rowspan || 1;
        _192.colspan = _192.colspan || 1;
        if (_192.rowspan == 1 && _192.colspan == 1) {
            return;
        }
        var tr = opts.finder.getTr(_191, (_192.index != undefined ? _192.index : _192.id), _192.type);
        if (!tr.length) {
            return;
        }
        var td = tr.find("td[field=\"" + _192.field + "\"]");
        td.attr("rowspan", _192.rowspan).attr("colspan", _192.colspan);
        td.addClass("datagrid-td-merged");
        _193(td.next(), _192.colspan - 1);
        for (var i = 1; i < _192.rowspan; i++) {
            tr = tr.next();
            if (!tr.length) {
                break;
            }
            td = tr.find("td[field=\"" + _192.field + "\"]");
            _193(td, _192.colspan);
        }
        _db(_191);
        function _193(td, _194) {
            for (var i = 0; i < _194; i++) {
                td.hide();
                td = td.next();
            }
        };
    };
    $.fn.datagrid = function (_195, _196) {
        if (typeof _195 == "string") {
            return $.fn.datagrid.methods[_195](this, _196);
        }
        _195 = _195 || {};
        return this.each(function () {
            var _197 = $.data(this, "datagrid");
            var opts;
            if (_197) {
                opts = $.extend(_197.options, _195);
                _197.options = opts;
            } else {
                opts = $.extend({}, $.extend({}, $.fn.datagrid.defaults, { queryParams: {} }), $.fn.datagrid.parseOptions(this), _195);
                $(this).css("width", "").css("height", "");
                var _198 = _51(this, opts.rownumbers);
                if (!opts.columns) {
                    opts.columns = _198.columns;
                }
                if (!opts.frozenColumns) {
                    opts.frozenColumns = _198.frozenColumns;
                }
                opts.columns = $.extend(true, [], opts.columns);
                opts.frozenColumns = $.extend(true, [], opts.frozenColumns);
                opts.view = $.extend({}, opts.view);
                $.data(this, "datagrid", { options: opts, panel: _198.panel, dc: _198.dc, ss: null, selectedRows: [], checkedRows: [], data: { total: 0, rows: [] }, originalRows: [], updatedRows: [], insertedRows: [], deletedRows: [] });
            }
            _5c(this);
            _77(this);
            _1e(this);
            if (opts.data) {
                _b1(this, opts.data);
                _178(this);
            } else {
                var data = $.fn.datagrid.parseData(this);
                if (data.total > 0) {
                    _b1(this, data);
                    _178(this);
                } else {
                    opts.view.renderEmptyRow(this);
                }
            }
            _b0(this);
        });
    };
    function _199(_19a) {
        var _19b = {};
        $.map(_19a, function (name) {
            _19b[name] = _19c(name);
        });
        return _19b;
        function _19c(name) {
            function isA(_19d) {
                return $.data($(_19d)[0], name) != undefined;
            };
            return {
                init: function (_19e, _19f) {
                    var _1a0 = $("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_19e);
                    if (_1a0[name] && name != "text") {
                        return _1a0[name](_19f);
                    } else {
                        return _1a0;
                    }
                }, destroy: function (_1a1) {
                    if (isA(_1a1, name)) {
                        $(_1a1)[name]("destroy");
                    }
                }, getValue: function (_1a2) {
                    if (isA(_1a2, name)) {
                        var opts = $(_1a2)[name]("options");
                        if (opts.multiple) {
                            return $(_1a2)[name]("getValues").join(opts.separator);
                        } else {
                            return $(_1a2)[name]("getValue");
                        }
                    } else {
                        return $(_1a2).val();
                    }
                }, setValue: function (_1a3, _1a4) {
                    if (isA(_1a3, name)) {
                        var opts = $(_1a3)[name]("options");
                        if (opts.multiple) {
                            if (_1a4) {
                                $(_1a3)[name]("setValues", _1a4.split(opts.separator));
                            } else {
                                $(_1a3)[name]("clear");
                            }
                        } else {
                            $(_1a3)[name]("setValue", _1a4);
                        }
                    } else {
                        $(_1a3).val(_1a4);
                    }
                }, resize: function (_1a5, _1a6) {
                    if (isA(_1a5, name)) {
                        $(_1a5)[name]("resize", _1a6);
                    } else {
                        $(_1a5)._outerWidth(_1a6)._outerHeight(22);
                    }
                }
            };
        };
    };
    var _1a7 = $.extend({}, _199(["text", "textbox", "numberbox", "numberspinner", "combobox", "combotree", "combogrid", "datebox", "datetimebox", "timespinner", "datetimespinner"]), {
        textarea: {
            init: function (_1a8, _1a9) {
                var _1aa = $("<textarea class=\"datagrid-editable-input\"></textarea>").appendTo(_1a8);
                return _1aa;
            }, getValue: function (_1ab) {
                return $(_1ab).val();
            }, setValue: function (_1ac, _1ad) {
                $(_1ac).val(_1ad);
            }, resize: function (_1ae, _1af) {
                $(_1ae)._outerWidth(_1af);
            }
        }, checkbox: {
            init: function (_1b0, _1b1) {
                var _1b2 = $("<input type=\"checkbox\">").appendTo(_1b0);
                _1b2.val(_1b1.on);
                _1b2.attr("offval", _1b1.off);
                return _1b2;
            }, getValue: function (_1b3) {
                if ($(_1b3).is(":checked")) {
                    return $(_1b3).val();
                } else {
                    return $(_1b3).attr("offval");
                }
            }, setValue: function (_1b4, _1b5) {
                var _1b6 = false;
                if ($(_1b4).val() == _1b5) {
                    _1b6 = true;
                }
                $(_1b4)._propAttr("checked", _1b6);
            }
        }, validatebox: {
            init: function (_1b7, _1b8) {
                var _1b9 = $("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_1b7);
                _1b9.validatebox(_1b8);
                return _1b9;
            }, destroy: function (_1ba) {
                $(_1ba).validatebox("destroy");
            }, getValue: function (_1bb) {
                return $(_1bb).val();
            }, setValue: function (_1bc, _1bd) {
                $(_1bc).val(_1bd);
            }, resize: function (_1be, _1bf) {
                $(_1be)._outerWidth(_1bf)._outerHeight(22);
            }
        }
    });
    $.fn.datagrid.methods = {
        options: function (jq) {
            var _1c0 = $.data(jq[0], "datagrid").options;
            var _1c1 = $.data(jq[0], "datagrid").panel.panel("options");
            var opts = $.extend(_1c0, { width: _1c1.width, height: _1c1.height, closed: _1c1.closed, collapsed: _1c1.collapsed, minimized: _1c1.minimized, maximized: _1c1.maximized });
            return opts;
        }, setSelectionState: function (jq) {
            return jq.each(function () {
                _fd(this);
            });
        }, createStyleSheet: function (jq) {
            return _b(jq[0]);
        }, getPanel: function (jq) {
            return $.data(jq[0], "datagrid").panel;
        }, getPager: function (jq) {
            return $.data(jq[0], "datagrid").panel.children("div.datagrid-pager");
        }, getColumnFields: function (jq, frozen) {
            return getColumnFields(jq[0], frozen);
        }, getColumnOption: function (jq, _1c3) {
            return _76(jq[0], _1c3);
        }, resize: function (jq, _1c4) {
            return jq.each(function () {
                _1e(this, _1c4);
            });
        }, load: function (jq, _1c5) {
            return jq.each(function () {
                var opts = $(this).datagrid("options");
                if (typeof _1c5 == "string") {
                    opts.url = _1c5;
                    _1c5 = null;
                }
                opts.pageNumber = 1;
                var _1c6 = $(this).datagrid("getPager");
                _1c6.pagination("refresh", { pageNumber: 1 });
                _b0(this, _1c5);
            });
        }, reload: function (jq, _1c7) {
            return jq.each(function () {
                var opts = $(this).datagrid("options");
                if (typeof _1c7 == "string") {
                    opts.url = _1c7;
                    _1c7 = null;
                }
                _b0(this, _1c7);
            });
        }, reloadFooter: function (jq, _1c8) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                var dc = $.data(this, "datagrid").dc;
                if (_1c8) {
                    $.data(this, "datagrid").footer = _1c8;
                }
                if (opts.showFooter) {
                    opts.view.renderFooter.call(opts.view, this, dc.footer2, false);
                    opts.view.renderFooter.call(opts.view, this, dc.footer1, true);
                    if (opts.view.onAfterRender) {
                        opts.view.onAfterRender.call(opts.view, this);
                    }
                    $(this).datagrid("fixRowHeight");
                }
            });
        }, loading: function (jq) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                $(this).datagrid("getPager").pagination("loading");
                if (opts.loadMsg) {
                    var _1c9 = $(this).datagrid("getPanel");
                    if (!_1c9.children("div.datagrid-mask").length) {
                        $("<div class=\"datagrid-mask\" style=\"display:block\"></div>").appendTo(_1c9);
                        var msg = $("<div class=\"datagrid-mask-msg\" style=\"display:block;left:50%\"></div>").html(opts.loadMsg).appendTo(_1c9);
                        msg._outerHeight(40);
                        msg.css({ marginLeft: (-msg.outerWidth() / 2), lineHeight: (msg.height() + "px") });
                    }
                }
            });
        }, loaded: function (jq) {
            return jq.each(function () {
                $(this).datagrid("getPager").pagination("loaded");
                var _1ca = $(this).datagrid("getPanel");
                _1ca.children("div.datagrid-mask-msg").remove();
                _1ca.children("div.datagrid-mask").remove();
            });
        }, fitColumns: function (jq) {
            return jq.each(function () {
                _b2(this);
            });
        }, fixColumnSize: function (jq, _1cb) {
            return jq.each(function () {
                _d5(this, _1cb);
            });
        }, fixRowHeight: function (jq, _1cc) {
            return jq.each(function () {
                _38(this, _1cc);
            });
        }, freezeRow: function (jq, _1cd) {
            return jq.each(function () {
                _49(this, _1cd);
            });
        }, autoSizeColumn: function (jq, _1ce) {
            return jq.each(function () {
                _c6(this, _1ce);
            });
        }, loadData: function (jq, data) {
            return jq.each(function () {
                _b1(this, data);
                _178(this);
            });
        }, getData: function (jq) {
            return $.data(jq[0], "datagrid").data;
        }, getRows: function (jq) {
            return $.data(jq[0], "datagrid").data.rows;
        }, getFooterRows: function (jq) {
            return $.data(jq[0], "datagrid").footer;
        }, getRowIndex: function (jq, id) {
            return getRowIndex(jq[0], id);
        }, getChecked: function (jq) {
            return _10b(jq[0]);
        }, getSelected: function (jq) {
            var rows = _108(jq[0]);
            return rows.length > 0 ? rows[0] : null;
        }, getSelections: function (jq) {
            return _108(jq[0]);
        }, clearSelections: function (jq) {
            return jq.each(function () {
                var _1cf = $.data(this, "datagrid");
                var _1d0 = _1cf.selectedRows;
                var _1d1 = _1cf.checkedRows;
                _1d0.splice(0, _1d0.length);
                _11c(this);
                if (_1cf.options.checkOnSelect) {
                    _1d1.splice(0, _1d1.length);
                }
            });
        }, clearChecked: function (jq) {
            return jq.each(function () {
                var _1d2 = $.data(this, "datagrid");
                var _1d3 = _1d2.selectedRows;
                var _1d4 = _1d2.checkedRows;
                _1d4.splice(0, _1d4.length);
                _12c(this);
                if (_1d2.options.selectOnCheck) {
                    _1d3.splice(0, _1d3.length);
                }
            });
        }, scrollTo: function (jq, _1d5) {
            return jq.each(function () {
                _10e(this, _1d5);
            });
        }, highlightRow: function (jq, _1d6) {
            return jq.each(function () {
                _8e(this, _1d6);
                _10e(this, _1d6);
            });
        }, selectAll: function (jq) {
            return jq.each(function () {
                _121(this);
            });
        }, unselectAll: function (jq) {
            return jq.each(function () {
                _11c(this);
            });
        }, selectRow: function (jq, _1d7) {
            return jq.each(function () {
                _97(this, _1d7);
            });
        }, selectRecord: function (jq, id) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                if (opts.idField) {
                    var _1d8 = getRowIndex(this, id);
                    if (_1d8 >= 0) {
                        $(this).datagrid("selectRow", _1d8);
                    }
                }
            });
        }, unselectRow: function (jq, _1d9) {
            return jq.each(function () {
                _98(this, _1d9);
            });
        }, checkRow: function (jq, _1da) {
            return jq.each(function () {
                _94(this, _1da);
            });
        }, uncheckRow: function (jq, _1db) {
            return jq.each(function () {
                _95(this, _1db);
            });
        }, checkAll: function (jq) {
            return jq.each(function () {
                _126(this);
            });
        }, uncheckAll: function (jq) {
            return jq.each(function () {
                _12c(this);
            });
        }, beginEdit: function (jq, _1dc) {
            return jq.each(function () {
                _13d(this, _1dc);
            });
        }, endEdit: function (jq, _1dd) {
            return jq.each(function () {
                _143(this, _1dd, false);
            });
        }, cancelEdit: function (jq, _1de) {
            return jq.each(function () {
                _143(this, _1de, true);
            });
        }, getEditors: function (jq, _1df) {
            return _150(jq[0], _1df);
        }, getEditor: function (jq, _1e0) {
            return _154(jq[0], _1e0);
        }, refreshRow: function (jq, _1e1) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                opts.view.refreshRow.call(opts.view, this, _1e1);
            });
        }, validateRow: function (jq, _1e2) {
            return _142(jq[0], _1e2);
        }, updateRow: function (jq, _1e3) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                opts.view.updateRow.call(opts.view, this, _1e3.index, _1e3.row);
            });
        }, appendRow: function (jq, row) {
            return jq.each(function () {
                _175(this, row);
            });
        }, insertRow: function (jq, _1e4) {
            return jq.each(function () {
                _171(this, _1e4);
            });
        }, deleteRow: function (jq, index) {
            return jq.each(function () {
                deleteRow(this, index);
            });
        }, getChanges: function (jq, _1e6) {
            return _165(jq[0], _1e6);
        }, acceptChanges: function (jq) {
            return jq.each(function () {
                _17c(this);
            });
        }, rejectChanges: function (jq) {
            return jq.each(function () {
                _17e(this);
            });
        }, mergeCells: function (jq, _1e7) {
            return jq.each(function () {
                _190(this, _1e7);
            });
        }, showColumn: function (jq, _1e8) {
            return jq.each(function () {
                var _1e9 = $(this).datagrid("getPanel");
                _1e9.find("td[field=\"" + _1e8 + "\"]").show();
                $(this).datagrid("getColumnOption", _1e8).hidden = false;
                $(this).datagrid("fitColumns");
            });
        }, hideColumn: function (jq, _1ea) {
            return jq.each(function () {
                var _1eb = $(this).datagrid("getPanel");
                _1eb.find("td[field=\"" + _1ea + "\"]").hide();
                $(this).datagrid("getColumnOption", _1ea).hidden = true;
                $(this).datagrid("fitColumns");
            });
        }, sort: function (jq, _1ec) {
            return jq.each(function () {
                _a4(this, _1ec);
            });
        }
    };
    $.fn.datagrid.parseOptions = function (_1ed) {
        var t = $(_1ed);
        return $.extend({}, $.fn.panel.parseOptions(_1ed), $.parser.parseOptions(_1ed, [
            "url", "toolbar", "idField", "sortName", "sortOrder", "pagePosition", "resizeHandle",
            {
                sharedStyleSheet: "boolean", fitColumns: "boolean", autoRowHeight: "boolean", striped: "boolean", nowrap: "boolean"
            },
            {
                rownumbers: "boolean", singleSelect: "boolean", ctrlSelect: "boolean", checkOnSelect: "boolean", selectOnCheck: "boolean"
            },
            {
                pagination: "boolean", pageSize: "number", pageNumber: "number"
            },
            {
                multiSort: "boolean", remoteSort: "boolean", showHeader: "boolean", showFooter: "boolean"
            },
            {
                scrollbarSize: "number"
            }]),
            {
                pageList: (t.attr("pageList") ? eval(t.attr("pageList")) : undefined),
                loadMsg: (t.attr("loadMsg") != undefined ? t.attr("loadMsg") : undefined),
                rowStyler: (t.attr("rowStyler") ? eval(t.attr("rowStyler")) : undefined)
            });
    };
    $.fn.datagrid.parseData = function (_1ee) {
        var t = $(_1ee);
        var data = { total: 0, rows: [] };
        var _1ef = t.datagrid("getColumnFields", true).concat(t.datagrid("getColumnFields", false));
        t.find("tbody tr").each(function () {
            data.total++;
            var row = {};
            $.extend(row, $.parser.parseOptions(this, ["iconCls", "state"]));
            for (var i = 0; i < _1ef.length; i++) {
                row[_1ef[i]] = $(this).find("td:eq(" + i + ")").html();
            }
            data.rows.push(row);
        });
        return data;
    };
    var view = {
        render: function (target, container, frozen) {
            var rows = $(target).datagrid("getRows");
            $(container).html(this.renderTable(target, 0, rows, frozen));
        },
        renderFooter: function (target, container, frozen) {
            var opts = $.data(target, "datagrid").options;
            var rows = $.data(target, "datagrid").footer || [];
            var fields = $(target).datagrid("getColumnFields", frozen);
            var ftable = ["<table class=\"datagrid-ftable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
            for (var i = 0; i < rows.length; i++) {
                ftable.push("<tr class=\"datagrid-row\" datagrid-row-index=\"" + i + "\">");
                ftable.push(this.renderRow.call(this, target, fields, frozen, i, rows[i]));
                ftable.push("</tr>");
            }
            ftable.push("</tbody></table>");
            $(container).html(ftable.join(""));
        },
        renderTable: function (target, rowIndex, rows, frozen) {
            var state = $.data(target, "datagrid");
            var opts = state.options;
            if (frozen) {
                if (!(opts.rownumbers || (opts.frozenColumns && opts.frozenColumns.length))) {
                    return "";
                }
            }
            var fields = $(target).datagrid("getColumnFields", frozen);
            var btable = ["<table class=\"datagrid-btable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
            for (var i = 0; i < rows.length; i++) {
                var row = rows[i];
                var css = opts.rowStyler ? opts.rowStyler.call(target, rowIndex, row) : "";
                var rowCls = "";
                var rowStyle = "";
                if (typeof css == "string") {
                    rowStyle = css;
                } else {
                    if (css) {
                        rowCls = css["class"] || "";
                        rowStyle = css["style"] || "";
                    }
                }
                var cls = "class=\"datagrid-row " + (rowIndex % 2 && opts.striped ? "datagrid-row-alt " : " ") + rowCls + "\"";
                var style = rowStyle ? "style=\"" + rowStyle + "\"" : "";
                var id = state.rowIdPrefix + "-" + (frozen ? 1 : 2) + "-" + rowIndex;
                btable.push("<tr id=\"" + id + "\" datagrid-row-index=\"" + rowIndex + "\" " + cls + " " + style + ">");
                btable.push(this.renderRow.call(this, target, fields, frozen, rowIndex, row));
                btable.push("</tr>");
                rowIndex++;
            }
            btable.push("</tbody></table>");
            return btable.join("");
        },
        renderRow: function (target, fields, frozen, rowIndex, rowData) {
            var opts = $.data(target, "datagrid").options;
            var cc = [];
            if (frozen && opts.rownumbers) {
                var rowNumber = rowIndex + 1;
                if (opts.pagination) {
                    rowNumber += (opts.pageNumber - 1) * opts.pageSize;
                }
                cc.push("<td class=\"datagrid-td-rownumber\"><div class=\"datagrid-cell-rownumber\">" + rowNumber + "</div></td>");
            }
            for (var i = 0; i < fields.length; i++) {
                var field = fields[i];
                var col = $(target).datagrid("getColumnOption", field);
                if (col) {
                    var value = rowData[field];
                    var css = col.styler ? (col.styler(value, rowData, rowIndex) || "") : "";
                    var rowCls = "";
                    var rowStyle = "";
                    if (typeof css == "string") {
                        rowStyle = css;
                    } else {
                        if (css) {
                            rowCls = css["class"] || "";
                            rowStyle = css["style"] || "";
                        }
                    }
                    var cls = rowCls ? "class=\"" + rowCls + "\"" : "";
                    var style = col.hidden ? "style=\"display:none;" + rowStyle + "\"" : (rowStyle ? "style=\"" + rowStyle + "\"" : "");
                    cc.push("<td field=\"" + field + "\" " + cls + " " + style + ">");
                    var style = "";
                    if (!col.checkbox) {
                        if (col.align) {
                            style += "text-align:" + col.align + ";";
                        }
                        if (!opts.nowrap) {
                            style += "white-space:normal;height:auto;";
                        } else {
                            if (opts.autoRowHeight) {
                                style += "height:auto;";
                            }
                        }
                    }
                    cc.push("<div style=\"" + style + "\" ");
                    cc.push(col.checkbox ? "class=\"datagrid-cell-check\"" : "class=\"datagrid-cell " + col.cellClass + "\"");
                    cc.push(">");
                    if (col.checkbox) {
                        cc.push("<input type=\"checkbox\" " + (rowData.checked ? "checked=\"checked\"" : ""));
                        cc.push(" name=\"" + field + "\" value=\"" + (value != undefined ? value : "") + "\">");
                    } else {
                        if (col.formatter) {
                            cc.push(col.formatter(value, rowData, _206));
                        } else {
                            cc.push(value);
                        }
                    }
                    cc.push("</div>");
                    cc.push("</td>");
                }
            }
            return cc.join("");
        },
        refreshRow: function (target, rowIndex) {
            this.updateRow.call(this, target, rowIndex, {});
        },
        updateRow: function (target, rowIndex, row) {
            var opts = $.data(target, "datagrid").options;
            var rows = $(target).datagrid("getRows");
            var oldFacade = getRowFacade(rowIndex);
            $.extend(rows[rowIndex], row);
            var newFacade = getRowFacade(rowIndex);
            var oldRowCls = oldFacade.c;
            var newRowStyle = newFacade.s;
            var newRowCls = "datagrid-row " + (rowIndex % 2 && opts.striped ? "datagrid-row-alt " : " ") + newFacade.c;
            function getRowFacade(index) {
                var css = opts.rowStyler ? opts.rowStyler.call(target, index, rows[index]) : "";
                var rowCls = "";
                var rowStyle = "";
                if (typeof css == "string") {
                    rowStyle = css;
                } else {
                    if (css) {
                        rowCls = css["class"] || "";
                        rowStyle = css["style"] || "";
                    }
                }
                return { c: rowCls, s: rowStyle };
            };
            function frozenRow(frozen) {
                var fields = $(target).datagrid("getColumnFields", frozen);
                var tr = opts.finder.getTr(target, rowIndex, "body", (frozen ? 1 : 2));
                var checked = tr.find("div.datagrid-cell-check input[type=checkbox]").is(":checked");
                tr.html(this.renderRow.call(this, target, fields, frozen, rowIndex, rows[rowIndex]));
                tr.attr("style", newRowStyle).removeClass(oldRowCls).addClass(newRowCls);
                if (checked) {
                    tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked", true);
                }
            };
            frozenRow.call(this, true);
            frozenRow.call(this, false);
            $(target).datagrid("fixRowHeight", rowIndex);
        },
        insertRow: function (_21f, _220, row) {
            var _221 = $.data(_21f, "datagrid");
            var opts = _221.options;
            var dc = _221.dc;
            var data = _221.data;
            if (_220 == undefined || _220 == null) {
                _220 = data.rows.length;
            }
            if (_220 > data.rows.length) {
                _220 = data.rows.length;
            }
            function _222(_223) {
                var _224 = _223 ? 1 : 2;
                for (var i = data.rows.length - 1; i >= _220; i--) {
                    var tr = opts.finder.getTr(_21f, i, "body", _224);
                    tr.attr("datagrid-row-index", i + 1);
                    tr.attr("id", _221.rowIdPrefix + "-" + _224 + "-" + (i + 1));
                    if (_223 && opts.rownumbers) {
                        var _225 = i + 2;
                        if (opts.pagination) {
                            _225 += (opts.pageNumber - 1) * opts.pageSize;
                        }
                        tr.find("div.datagrid-cell-rownumber").html(_225);
                    }
                    if (opts.striped) {
                        tr.removeClass("datagrid-row-alt").addClass((i + 1) % 2 ? "datagrid-row-alt" : "");
                    }
                }
            };
            function _226(_227) {
                var _228 = _227 ? 1 : 2;
                var _229 = $(_21f).datagrid("getColumnFields", _227);
                var _22a = _221.rowIdPrefix + "-" + _228 + "-" + _220;
                var tr = "<tr id=\"" + _22a + "\" class=\"datagrid-row\" datagrid-row-index=\"" + _220 + "\"></tr>";
                if (_220 >= data.rows.length) {
                    if (data.rows.length) {
                        opts.finder.getTr(_21f, "", "last", _228).after(tr);
                    } else {
                        var cc = _227 ? dc.body1 : dc.body2;
                        cc.html("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>" + tr + "</tbody></table>");
                    }
                } else {
                    opts.finder.getTr(_21f, _220 + 1, "body", _228).before(tr);
                }
            };
            _222.call(this, true);
            _222.call(this, false);
            _226.call(this, true);
            _226.call(this, false);
            data.total += 1;
            data.rows.splice(_220, 0, row);
            this.refreshRow.call(this, _21f, _220);
        },
        deleteRow: function (_22b, _22c) {
            var _22d = $.data(_22b, "datagrid");
            var opts = _22d.options;
            var data = _22d.data;
            function _22e(_22f) {
                var _230 = _22f ? 1 : 2;
                for (var i = _22c + 1; i < data.rows.length; i++) {
                    var tr = opts.finder.getTr(_22b, i, "body", _230);
                    tr.attr("datagrid-row-index", i - 1);
                    tr.attr("id", _22d.rowIdPrefix + "-" + _230 + "-" + (i - 1));
                    if (_22f && opts.rownumbers) {
                        var _231 = i;
                        if (opts.pagination) {
                            _231 += (opts.pageNumber - 1) * opts.pageSize;
                        }
                        tr.find("div.datagrid-cell-rownumber").html(_231);
                    }
                    if (opts.striped) {
                        tr.removeClass("datagrid-row-alt").addClass((i - 1) % 2 ? "datagrid-row-alt" : "");
                    }
                }
            };
            opts.finder.getTr(_22b, _22c).remove();
            _22e.call(this, true);
            _22e.call(this, false);
            data.total -= 1;
            data.rows.splice(_22c, 1);
        },
        onBeforeRender: function (_232, rows) {
        },
        onAfterRender: function (_233) {
            var _234 = $.data(_233, "datagrid");
            var opts = _234.options;
            if (opts.showFooter) {
                var _235 = $(_233).datagrid("getPanel").find("div.datagrid-footer");
                _235.find("div.datagrid-cell-rownumber,div.datagrid-cell-check").css("visibility", "hidden");
            }
            if (opts.finder.getRows(_233).length == 0) {
                this.renderEmptyRow(_233);
            }
        },
        renderEmptyRow: function (_236) {
            var dc = $.data(_236, "datagrid").dc;
            dc.body2.html(this.renderTable(_236, 0, [{}], false));
            dc.body2.find(".datagrid-row").removeClass("datagrid-row").removeAttr("datagrid-row-index");
            dc.body2.find("tbody *").css({ height: 1, borderColor: "transparent", background: "transparent" });
        }
    };
    $.fn.datagrid.defaults = $.extend({}, $.fn.panel.defaults, {
        sharedStyleSheet: false,
        frozenColumns: undefined,
        columns: undefined,
        fitColumns: false,
        resizeHandle: "right",
        autoRowHeight: true,
        toolbar: null,
        striped: false,
        method: "post",
        nowrap: true,
        idField: null,
        url: null,
        data: null,
        loadMsg: "Processing, please wait ...",
        rownumbers: false,
        singleSelect: false,
        ctrlSelect: false,
        selectOnCheck: true,
        checkOnSelect: true,
        pagination: false,
        pagePosition: "bottom",
        pageNumber: 1,
        pageSize: 10,
        pageList: [10, 20, 30, 40, 50],
        queryParams: {},
        sortName: null,
        sortOrder: "asc",
        multiSort: false,
        remoteSort: true,
        showHeader: true,
        showFooter: false,
        scrollbarSize: 18,
        rowEvents: {
            mouseover: _87(true),
            mouseout: _87(false),
            click: _90,
            dblclick: _9b,
            contextmenu: _a0
        },
        rowStyler: function (_237, _238) { },
        loader: function (_239, _23a, _23b) {
            var opts = $(this).datagrid("options");
            if (!opts.url) {
                return false;
            }
            $.ajax({
                type: opts.method, url: opts.url, data: _239, dataType: "json", success: function (data) {
                    _23a(data);
                }, error: function () {
                    _23b.apply(this, arguments);
                }
            });
        },
        loadFilter: function (data) {
            if (typeof data.length == "number" && typeof data.splice == "function") {
                return { total: data.length, rows: data };
            } else {
                return data;
            }
        },
        editors: _1a7,
        finder: {
            getTr: function (_23c, _23d, type, _23e) {
                type = type || "body";
                _23e = _23e || 0;
                var _23f = $.data(_23c, "datagrid");
                var dc = _23f.dc;
                var opts = _23f.options;
                if (_23e == 0) {
                    var tr1 = opts.finder.getTr(_23c, _23d, type, 1);
                    var tr2 = opts.finder.getTr(_23c, _23d, type, 2);
                    return tr1.add(tr2);
                } else {
                    if (type == "body") {
                        var tr = $("#" + _23f.rowIdPrefix + "-" + _23e + "-" + _23d);
                        if (!tr.length) {
                            tr = (_23e == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr[datagrid-row-index=" + _23d + "]");
                        }
                        return tr;
                    } else {
                        if (type == "footer") {
                            return (_23e == 1 ? dc.footer1 : dc.footer2).find(">table>tbody>tr[datagrid-row-index=" + _23d + "]");
                        } else {
                            if (type == "selected") {
                                return (_23e == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr.datagrid-row-selected");
                            } else {
                                if (type == "highlight") {
                                    return (_23e == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr.datagrid-row-over");
                                } else {
                                    if (type == "checked") {
                                        return (_23e == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr.datagrid-row-checked");
                                    } else {
                                        if (type == "editing") {
                                            return (_23e == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr.datagrid-row-editing");
                                        } else {
                                            if (type == "last") {
                                                return (_23e == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr[datagrid-row-index]:last");
                                            } else {
                                                if (type == "allbody") {
                                                    return (_23e == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr[datagrid-row-index]");
                                                } else {
                                                    if (type == "allfooter") {
                                                        return (_23e == 1 ? dc.footer1 : dc.footer2).find(">table>tbody>tr[datagrid-row-index]");
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            getRow: function (_240, p) {
                var _241 = (typeof p == "object") ? p.attr("datagrid-row-index") : p;
                return $.data(_240, "datagrid").data.rows[parseInt(_241)];
            },
            getRows: function (_242) {
                return $(_242).datagrid("getRows");
            }
        },
        view: view,
        onBeforeLoad: function (_243) { },
        onLoadSuccess: function () { },
        onLoadError: function () { },
        onClickRow: function (_244, _245) { },
        onDblClickRow: function (_246, _247) { },
        onClickCell: function (_248, _249, _24a) { },
        onDblClickCell: function (_24b, _24c, _24d) { },
        onBeforeSortColumn: function (sort, _24e) { },
        onSortColumn: function (sort, _24f) { },
        onResizeColumn: function (_250, _251) { },
        onBeforeSelect: function (_252, _253) { },
        onSelect: function (_254, _255) { },
        onBeforeUnselect: function (_256, _257) { },
        onUnselect: function (_258, _259) { },
        onSelectAll: function (rows) { },
        onUnselectAll: function (rows) { },
        onBeforeCheck: function (_25a, _25b) { },
        onCheck: function (_25c, _25d) { },
        onBeforeUncheck: function (_25e, _25f) { },
        onUncheck: function (_260, _261) { },
        onCheckAll: function (rows) { },
        onUncheckAll: function (rows) { },
        onBeforeEdit: function (_262, _263) { },
        onBeginEdit: function (_264, _265) { },
        onEndEdit: function (_266, _267, _268) { },
        onAfterEdit: function (_269, _26a, _26b) { },
        onCancelEdit: function (_26c, _26d) { },
        onHeaderContextMenu: function (e, _26e) { },
        onRowContextMenu: function (e, _26f, _270) { }
    });
})(jQuery);

